<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 普通
        /* let str = '<a href="https://www.apple.com.cn">Apple</a>'
        const reg = /<a href="(.*)">(.*)<\/a>/
        const result = reg.exec(str)
        console.log(result) */

        // 分组
        let str = '<a href="https://www.apple.com.cn">Apple</a>'
        const reg = /<a href="(?<href>.*)">(?<label>.*)<\/a>/
        const result = reg.exec(str)
        console.log(result)
    </script>
</body>
</html>